A barcode includes a group of lines and spacing symbols that are arranged based on a specific coding rule, and is used to indicate information about a specific character, digit, or symbol. Examples of barcodes include one-dimensional barcodes and two-dimensional barcodes. The one-dimensional barcode is used to express information by arranging a plurality of black lines and spacings with different widths based on a certain rule. The two-dimensional barcode (also referred to as a quick response code) is used to record information by using a pattern with black and white geometric figures alternated on a (two-dimensional) plane based on a certain rule.
With development of mobile Internet technologies and popularization of intelligent terminals, barcodes are widely applied to various near field services based on user accounts. Two users can implement services such as mobile payment and information sharing between accounts by scanning a one-dimensional barcode or a two-dimensional code.
In the existing technology, barcode scanning communication between two devices is unidirectional communication, and a device that displays the barcode cannot obtain a processing result of information in the barcode from a device that scans the barcode. In response to determining that a service is performed by using the barcode, such unidirectional communication can cause information asymmetry between two communication parties and affect service security and integrity.
For example, in response to determining that a payment service is performed by using a barcode, a merchant cashier terminal with a code scanner obtains a user account after scanning a payment two-dimensional code displayed by a user terminal, and initiates a payment request to a payment server by using the user account, a merchant account, and an amount. After completing a transfer between the user account and the merchant account, the payment server separately sends a payment result to the merchant cashier terminal and the user terminal. In response to determining that a user is in an area such as a new development area, an underground store, or a foreign country that is not covered by a mobile data network, the user terminal cannot immediately receive the payment result while the merchant cashier terminal can receive the payment result because the merchant cashier terminal and the payment server usually communicate with each other through a wired network and can successfully complete the payment. Because of the previous information asymmetry, the user cannot confirm a payment amount and whether the payment is successful. Therefore, it is difficult to ensure the payment security of the user.